﻿using System;
using CommandLine;

namespace Command.Commands
{
	public interface ICommand
	{
		void Execute(string[] args);
	}

	public abstract class BaseCommand<T> : ICommand
	{
		public void Execute(string[] args)
		{
			var options = Activator.CreateInstance<T>();
			ICommandLineParser parser = new CommandLineParser();
			if (parser.ParseArguments(args, options))
				InternalExecute(options);
		}

		protected abstract void InternalExecute(T options);
	}
}
